﻿using M_Quality.API.Application.Command.RawMaterialQualityCommand;
using M_Quality.Domain;
using M_Quality.Repository.Interface;
using MediatR;

namespace M_Quality.API.Application.CommandHandler.RawMaterialQualityCommandHandler
{
    public class GetListCommandHandler : IRequestHandler<GetListCommand, List<RawMaterialQuality>>
    {
        private readonly IRawMaterialQualityRepository rawMaterialQualityRepository;

        public GetListCommandHandler(IRawMaterialQualityRepository rawMaterialQualityRepository)
        {
            this.rawMaterialQualityRepository = rawMaterialQualityRepository;
        }

        public async Task<List<RawMaterialQuality>> Handle(GetListCommand request, CancellationToken cancellationToken)
        {
            return await rawMaterialQualityRepository.GetListAsync(request.RNumber,request.MNumber,request.State);
        }
    }
}
